<%@page import="java.util.UUID"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/pages/common/taglib.jsp" %>
<%
    String uuid = UUID.randomUUID().toString();
    request.setAttribute("uuid", uuid);
%>
<div style="height:100%" id="formView_${uuid}">
	<form method="post">
			
	</form>
	<div id="subModelView_${uuid}">
		<ul class="nav nav-tabs" role="tablist">
			
		</ul>
		<div class="tab-content am-margin-vertical-sm">
			
		</div>
	</div>
</div>
<script type="text/javascript">
$(function(){
	var dms='${param.dms}';//数据模型,可能有多个
	var dataId='${param.dataId}';
	var winId='${param.winId}';
	var uuid = '${uuid}';
	var dmParams='${dmParams}'?eval('(${dmParams})'):"";
	var side='${param.side}'||'server';
	var extScript='${param.extScript}';
	require(['wiseMen/dataModel/FormBuilder'],function(FormBuilder){		
		
		var formBuilder=new FormBuilder({
			uuid:uuid,
			dataId:dataId,
			side:side,
			formViewDom:$("#formView_"+uuid+" form"),
			submitBtDom:$("#submitBt_"+uuid),
			subModelViewDom:$("#subModelView_"+uuid),
			extScript:extScript,
			onSubmitSuccess:function(data){
				if(winId){
					webUtils.topicPublish("dialog.submit.success."+winId,data);
				}
			}
		});
		
		if(winId){
			webUtils.topicSubscribe("dialog.close."+winId,function(data){
				formBuilder.destroy();
			});
		}

		if(dms){
			var dmList=dms.split(",");
			$.each(dmList,function(i,n){
				var paramDatas=dmParams[n];
				formBuilder.addDataModel({
					dataModelCode:n,
					readOnly:true,
					paramDatas:paramDatas
				});
			});
		};
		formBuilder.build();
	});
});
</script>